<template>
	<view class="context">
		<view class="s-tit">{{title}}</view>
		<dropdownMenu ref="dealer" 
			:descObj="dealData" 
			:list="dataList"
			 @changeMenu="setDealData">
		</dropdownMenu>
	</view>
</template>

<script>
	import dropdownMenu from "./DropdownMenu.vue";
	import goodsCtrl from "../../js/gd/GoodsCtrl.js";
	import lang from "../../js/conf/Lang.js";
	export default
	{
		components : {dropdownMenu},
		data()
		{
			return{
				dealData:{},
				dataList : [],
				title:lang.dealerTxt.title,
			}
		},
		
		methods:
		{
			setDealData(item)
			{
				this.dealData = item;
				goodsCtrl.setDealer(item);
			},
			
			/*** 初始化数据 ***/
			async initData()
			{
				this.dealData = {};
				this.dataList = [];
				this.dataList = goodsCtrl.getUcpList();
				this.dealData = await goodsCtrl.setInitUcp();
				if(this.dealData)
					this.$refs.dealer.setCurId(this.dealData.uid);
			},
		}
	}
</script>

<style lang="scss">
	.context
	{
		margin: 10px 0;
		font-size: 13px;
		.s-tit
		{
			font-weight: bold;
		}
	}
</style>
